//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CCanvasProxy.h>
///	@path	~/src/graphics/canvas/
///	@date	2008/04/23
///	@desc	.

#pragma once

#include "xeres.h"

#include "lib/utilities/callback.h"

#include "graphics/ICanvas.h"

namespace xeres {

	/*! 
		\class	CCanvasProxy
		\brief	Render proxy for intrusive render in canvas sequence.
	*/
	class CCanvasProxy : public ICanvas
	{
	public:

		/// \ctor
		CCanvasProxy( function<void(RenderContext&)> call );

		/// \dtor
		virtual ~CCanvasProxy( void );

		DECL_IOBJECT_CLASS( CCanvasProxy , ICanvas );

	public:

		/// \impl
		virtual void Initialize( RefWeak<IRenderer> renderer );

		/// \impl
		virtual void Finalize( void );

		/// \impl
		virtual void Render( RenderContext& rc );

		/*!
			\brief		Set proxy call.
		*/
		void SetProxy( function<void(RenderContext&)> call );

	private:

		//@ data
		function<void(RenderContext&)>		m_call;
	};

} // namespace xeres
